package dormouse.vfs.ui.renderers;

import java.awt.Component;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JPanel;

import dormouse.vfs.event.FileSelectionEventMixin;
import dormouse.vfs.event.IFileSelectionEvent;
import dormouse.vfs.event.IFileSelectionListener;

/**
 * This class provides a basis for the development of FileListRenderers.
 */
public abstract class AbstractFileListRenderer extends JPanel implements IFileListRenderer<Component> {
    
    /** Serial UID. */
	private static final long serialVersionUID = 2249138218041264346L;
	
    
	protected String menuName = null;
	
	protected FileSelectionEventMixin fileSelectionMixin = new FileSelectionEventMixin();

    

    public AbstractFileListRenderer(String menuName) {
        this.menuName = menuName;
    }

    public void addFileSelectionListener(IFileSelectionListener listener) {
        fileSelectionMixin.addFileSelectionListener(listener);
    }

    public void notifyFileSelectionListeners(IFileSelectionEvent event) {
        fileSelectionMixin.notify(event);
    }

    public void removeAllFileSelectionListeners() {
        fileSelectionMixin.removeAll();
    }

    public void removeFileSelectionListener(IFileSelectionListener listener) {
        fileSelectionMixin.removeFileSelectionListener(listener);
    }
    
    public String toString(){
        return this.menuName;
    }


}
